#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "date.h"

#define DATE_FMT "%H-%M-%Y"
#define DATE_MAXSIZ 32
__BLTIN_ST char *date_var_args[] = { "blubb", NULL };
__BLTIN_VAR date_var = { "date", date_var_args, { NULL, NULL, NULL, NULL, NULL, __date }, VAR_SIMPLE };

void
__date(const struct var_reqdata *vr)
{
  char date[DATE_MAXSIZ + 1];
  time_t t;
  struct tm *tmp;
  
  t = time(NULL);
  tmp = localtime(&t);
  if (strftime(date, DATE_MAXSIZ, DATE_FMT, tmp) > 0)
  {
    set_string(vr->result, date);
  }
}

